home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / doodle_d.swf / scripts / DefineSprite_4_en16 / frame_1 / DoAction.as
Text File  |  2013-04-24  |  1KB  |  47 lines

  1. function onEnterFrame()
  2. {
  3.    if(_root.shieldMC.hitTest(_X,_Y,true) && _root.shieldLevel >= 2)
  4.    {
  5.       dx = 0;
  6.       dy = 0;
  7.    }
  8.    _X = _X + dx;
  9.    _Y = _Y + dy;
  10.    if(_Y > 880 || _Y < 0)
  11.    {
  12.       dy *= -1;
  13.       _Y = _Y + dy * 2;
  14.    }
  15.    if(_X < 0 || _X > 640)
  16.    {
  17.       dx *= -1;
  18.       _X = _X + dx * 2;
  19.    }
  20.    if(this.hitTest(_root.ship))
  21.    {
  22.       depth = _root.getNextHighestDepth();
  23.       _root.attachMovie("exp","exp" + depth,depth);
  24.       exp = eval("_root.exp" + depth);
  25.       exp._x = _X;
  26.       exp._y = _Y;
  27.       _root.eAmount--;
  28.       _root.death();
  29.       this.removeMovieClip();
  30.    }
  31.    if(h <= 0)
  32.    {
  33.       _root.eAmount--;
  34.       _root.points += 500;
  35.       _root.eD = _root.eD + 1;
  36.       depth = _root.getNextHighestDepth();
  37.       _root.attachMovie("exp","exp" + depth,depth);
  38.       exp = eval("_root.exp" + depth);
  39.       exp._x = _X;
  40.       exp._y = _Y;
  41.       this.removeMovieClip();
  42.    }
  43. }
  44. dx = Math.random() * 5 + 5;
  45. dy = (Math.random() * 3 + 3) * -1;
  46. h = 50;
  47.